/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.hostess.controller;

import br.hostess.model.*;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Vector;

/**
 *
 * @author Marcelo Daibert
 */
public class cntrEfetivarRegistro {

    private Registro objRegistro;
    private RandomGUID objGUID;

    public cntrEfetivarRegistro(){
        this.objRegistro = new Registro();
        this.objGUID = new RandomGUID();
    }
    
    public boolean registrarEntradaSaida(String pOIDUser, String pOIDEvento){
        Calendar objCalendario = Calendar.getInstance();
        Date objAgora = objCalendario.getTime();
        
        //System.out.println("Data: "+objAgora.getTime());
        
        //long vTime = 1307325655293L;
        //objAgora.setTime(vTime);
        //System.out.println("Data: "+objAgora.toString());
        
        this.objRegistro.setOid(objGUID.toString());
        this.objRegistro.setData(objAgora.getTime());
        this.objRegistro.setEvento(Evento.recuperaObjeto(pOIDEvento));
        this.objRegistro.setParticipante(Participante.recuperaObjeto(pOIDUser));
        //System.out.println(""+this.objRegistro.toString());
        if (this.objRegistro.persistir()){
            return true;
        }else{
            return false;
        }
    }
    
}
